package com.smcdd.cdb.dbo.cdb_dbo.ui.utils;

import android.os.Build;
import android.os.Environment;

/**
 * 作者：Administrator on 2017/5/23 11:25
 * 邮箱：zhanghuaiha@gmail.com
 * 获取api>23和<23SD路径工具类
 */

public class SdcardPathUtil {


    public static String getSdPath(){
        String path = "";
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            //内置sd卡路径
          //  String sdcardPath = System.getenv("EXTERNAL_STORAGE");
            //外置置sd卡路径
            path = System.getenv("SECONDARY_STORAGE");
            if (path == null || path.equals("")) {
                //内置sd卡路径
                path = Environment.getExternalStorageDirectory().getAbsolutePath();
            }
        }else {
            path = Environment.getExternalStorageDirectory().getPath();
        }
        return path;
    }
}
